package com.huangsm.book.designmodel.jdkobserver;

import lombok.extern.slf4j.Slf4j;

import java.util.Observable;
import java.util.Observer;

/**
 * 具体观察对象
 * @author huang
 * @PACKAGE_NAME com.huangsm.book.designmodel.jdkobserver
 * @PROJECT_NAME concurrence
 * @date 2019/2/15
 */
@Slf4j
public class ConcreteObserver implements Observer {

    /**
     * @param o 具体主题对象
     * @param arg notifyObservers(String str)传递的参数
     */
    @Override
    public void update(Observable o, Object arg) {
      log.info(arg.toString());
      ConcreteSubject subject= (ConcreteSubject) o;
      log.info("observer:{}",subject.getInfo());
    }
}
